Skip to main content
POST
/
v1
/
promotions
/
tiers
/
{tierId}
/
validation
curl --request POST \
--url https://{cluster}.voucherify.io/v1/promotions/tiers/{tierId}/validation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-App-Id: <api-key>' \
--header 'X-App-Token: <api-key>' \
--data '{
"customer": {
"source_id": "test-user@email.io"
},
"order": {
"id": "ord_71uW6qnB5CFZlLHCeCNC4qtS"
}
}'
{
"valid": true,
"applicable_to": {
"data": [],
"total": 0,
"data_ref": "data",
"object": "list"
},
"inapplicable_to": {
"data": [],
"total": 0,
"data_ref": "data",
"object": "list"
},
"tracking_id": "track_OWyBVb1mg1qnieLLNygh19A0Ia7FsJck",
"order": {
"id": "ord_71uW6qnB5CFZlLHCeCNC4qtS",
"source_id": null,
"created_at": "2022-11-17T12:17:55.096Z",
"updated_at": null,
"status": "CREATED",
"amount": 9918200,
"initial_amount": 468200,
"items_discount_amount": 9450000,
"total_discount_amount": 9450000,
"total_amount": 468200,
"items_applied_discount_amount": 9450000,
"total_applied_discount_amount": 9450000,
"items": [
{
"object": "order_item",
"source_id": "webinar_BF_sweater_pink_sweater",
"related_object": "product",
"quantity": 1,
"amount": 6500,
"price": 6500,
"subtotal_amount": 6500
},
{
"object": "order_item",
"source_id": "webinar_BF_pants_navy_sweat_pants",
"related_object": "product",
"quantity": 1,
"amount": 6000,
"price": 6000,
"subtotal_amount": 6000
},
{
"object": "order_item",
"source_id": "5h1pp1ng",
"related_object": "product",
"quantity": 1,
"amount": 2000,
"price": 2000,
"subtotal_amount": 2000,
"product": {
"id": "prod_5h1pp1ng",
"source_id": "5h1pp1ng",
"name": "Shipping"
}
},
{
"object": "order_item",
"source_id": "webinar_BF_pants_gray_sweat_pants",
"related_object": "product",
"quantity": 2,
"amount": 10000,
"price": 5000,
"subtotal_amount": 10000
},
{
"object": "order_item",
"source_id": "webinar_BF_sweater_pearl",
"related_object": "product",
"quantity": 2,
"amount": 22000,
"price": 11000,
"subtotal_amount": 22000
},
{
"object": "order_item",
"product_id": "prod_0b7d7dfb05cbe5c616",
"sku_id": "sku_0b7d7dfb090be5c619",
"quantity": 1,
"amount": 1700,
"price": 1700,
"subtotal_amount": 1700,
"product": {
"id": "prod_0b7d7dfb05cbe5c616",
"source_id": "Books",
"name": "Comic Books1",
"price": 2100
},
"sku": {
"id": "sku_0b7d7dfb090be5c619",
"source_id": "ComicBook_1",
"sku": "Comics1",
"price": 1700
}
},
{
"object": "order_item",
"product_id": "prod_0bae32322150fd0546",
"quantity": 2,
"amount": 420000,
"price": 210000,
"subtotal_amount": 420000,
"product": {
"id": "prod_0bae32322150fd0546",
"name": "Samsung Phone",
"price": 210000
}
},
{
"object": "order_item",
"product_id": "prod_0bae2dc5a090fd0184",
"sku_id": "sku_0bae3b28f610fd0da1",
"quantity": 45,
"discount_quantity": 45,
"initial_quantity": 0,
"amount": 9450000,
"discount_amount": 9450000,
"initial_amount": 0,
"applied_discount_amount": 9450000,
"price": 210000,
"subtotal_amount": 0,
"product": {
"id": "prod_0bae2dc5a090fd0184",
"source_id": "first_product",
"name": "Samsung Phone 1",
"price": 220000
},
"sku": {
"id": "sku_0bae3b28f610fd0da1",
"source_id": "first_product_sku_1",
"sku": "Samsung phone 256GB",
"price": 210000
}
}
],
"metadata": {},
"customer_id": null,
"referrer_id": null,
"object": "order"
},
"id": "promo_ZWkx6R0I1Ts3N9HL4kfTdxOm",
"name": "Add new SKU",
"discount": {
"type": "UNIT",
"effect": "ADD_NEW_ITEMS",
"unit_off": 45,
"unit_type": "sku_0bae3b28f610fd0da1",
"sku": {
"id": "sku_0bae3b28f610fd0da1",
"source_id": "first_product_sku_1",
"sku": "Samsung phone 256GB"
},
"product": {
"id": "prod_0bae2dc5a090fd0184",
"source_id": "first_product",
"name": "Samsung Phone 1"
}
},
"campaign": {
"id": "camp_40LC42P5NFbkkD4RWoJ4btks",
"start_date": null,
"expiration_date": null,
"active": true,
"object": "campaign"
},
"hierarchy": 4,
"discount_amount": 9450000,
"applied_discount_amount": 9450000,
"metadata": {},
"object": "promotion_tier"
}

Authorizations

X-App-Id
string
header
required
X-App-Token
string
header
required
Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Path Parameters

tierId
string
required

Unique promotion tier ID.

Body

application/json

Provide the customer and order context.

Request schema model for validating a promotion using POST v1/promotions/tiers/{tierId}/validation.

customer
object

Customer's information. You can pass the unique customer ID that was assigned by Voucherify.

  • Customer ID
  • Customer Source ID
  • Customer
order
object

Order information. You can pass the unique order ID that was assigned by Voucherify.

  • Order ID
  • Order Source ID
  • Order Customer And Referrer Ids Objects
metadata
object

A set of key/value pairs that you can send in the request body to check against vouchers requiring redemption metadata validation rules to be satisfied. The validation runs against rules that are defined through the <!-- [Create Validation Rules](https://docs.voucherify.io/reference/create-validation-rules) -->Create Validation Rules endpoint or via the Dashboard; in the Advanced Rule BuilderAdvancedRedemption metadata satisfy or Basic BuilderAttributes matchREDEMPTION METADATA. Read more.

Response

200 - application/json

Returns validation result in valid key of the promotion tier object. Returns true if the promotion tier rules and validation rules are satisfied given the request body parameters. Returns false if the data provided in the payload does not meet validation rules or promotion tier requirements.

  • Promotion Tier Valid
  • Promotion Tier Not Valid

Response schema model for validating a promotion using POST v1/promotions/tiers/{tierId}/validation. Response schema model for valid promotion tier when validating a promotion using POST v1/promotions/tiers/{tierId}/validation.

valid
string

Indicates whether the promotion is valid within the context of the parameters provided in the request body and filters in the query parameters.

applicable_to
object

Contains list of items that qualify in the scope of the discount. These are definitions of included products, SKUs, and product collections. These can be discounted.

inapplicable_to
object

Contains list of items that do not qualify in the scope of the discount. These are definitions of excluded products, SKUs, and product collections. These CANNOT be discounted.

tracking_id
string

Hashed customer source ID.

order
object

This is an object representing an order with calculated discounts applied using the voucher code.

  • Order object - Effect: Apply to order
  • Order object - Effect: Apply to items
id
string

Unique promotion tier ID.

Example:

"promo_4TqHr24boFISDrcOHSlfAxwm"

name
string

Custom promotion tier name.

banner
string

Text to be displayed to your customers on your website.

Example:

"Get 45% off items"

discount
object

Contains information about the discount to be applied to the order. This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.

  • Amount Discount
  • Percent Discount
  • Fixed Discount
  • Unit Discount, Product
  • Unit Discount, SKU
  • Unit Discount, multiple items
  • Shipping Discount
start_date
string<date-time>

Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Campaign is inactive before this date.

Example:

"2022-11-02T00:00:00.000Z"

expiration_date
string<date-time>

Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is inactive after this date.

Example:

"2022-11-04T00:00:00.000Z"

campaign
object
hierarchy
integer

The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy.

discount_amount
integer

The calculated discount amount based on the discount type and effect.

applied_discount_amount
integer

The effective discount amount that would be applied to the order.

metadata
object

The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format.

object
string
default:promotion_tier

The type of the object represented by JSON. This object stores information about the promotion tier.

I